package com.ashin.mq.listener;

import com.ashin.common.RabbitMQConfig;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

import java.util.Map;

import static com.ashin.common.RabbitMQConfig.BINDING_KEY_GOOD;
import static com.ashin.common.RabbitMQConfig.BINDING_KEY_ORDER;


public class RabbitMQConsumerTwo {


    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue(value = RabbitMQConfig.QUEUE_TEST), exchange = @Exchange(value = RabbitMQConfig.EXCHANGE_TOPIC_TEST, type = ExchangeTypes.TOPIC), key = {BINDING_KEY_GOOD}),
    })
    public void handler(Map map, Message message, Channel channel) {
        System.out.println("收到消息2" + map.toString());
        System.out.println(message);
        System.out.println(channel);
    }

}
